use "dta\LocalNationalWomenOverTime.dta", clear

** Type=1 local councilors
** Type=2 local mayors
** Type=3 Members of parliament 
** Type=4 Cabinet members
** Type=5 List leaders
** Type=6 National candidates

reshape wide fraction_women, i(year) j(type)
*** Share of men in mayoral position subtracted share of men councilors 
gen local_gap= (1-fraction_women2) - (1-fraction_women1)

*** Share of men in national list-leader positions and the share of men among MPs
gen national_gap1= (1-fraction_women5) - (1-fraction_women3)

*** Share of men in national list-leader positions and the share of women candidates
gen national_gap2= (1-fraction_women5) - (1-fraction_women6)

tw (scatter local_gap year, connect(l) lpattern(solid) lcolor(black) lcolor(gray*0.5) msymbol(circle) mcolor(gray*0.5)) ///
(scatter national_gap1 year,  connect(l) lpattern(solid) lcolor(black) msymbol(triangle) mcolor(gray*0.75))  ///
(scatter national_gap2 year,  connect(l) lpattern(solid) lcolor(black) msymbol(square) mcolor(black)),  ///
xlabel(1920 (5) 2025, labsize(small) angle(45)) plotregion(lcolor(white) ilcolor(white)) graphregion(color(white)) ylabel(,angle(0)) xtitle(Election year) ytitle(Difference in share of positions held by men) ylabel(0(0.05)0.25) scheme(s2mono) legend(order(1 "Mayors vs. Councilors" 2 "List Leaders vs. MPs" 3 "List Leaders vs. Candidates") pos(11) ring(0) col(1) region(lstyle(none)))  
graph export figures\Figure2.pdf, replace
